package yaq.mini.weibo.leafwb.mapper;

import yaq.mini.weibo.leafwb.pojo.Picture;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface PictureMapper {

    Picture getFullPictureByID(String pictureId);

    @Select("select * from picture where pictureId = #{pictureId}")
    Picture getPictureByID(String pictureId);

    @Select("select * from picture where articleId=#{articleId}")
    List<Picture> getListPictureByAID(String articleId);

    @Insert("insert into picture values(#{articleId},#{pictureId},#{url})")
    int insert(Picture picture);

    @Update("update Picture set url=#{url} where pictureId=#{pictureId}")
    int update(Picture picture);

    @Delete("delete from Picture where articleId=#{articleId}")
    int deleteByAID(String articleId);

}
